package entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.ManyToMany;
import java.util.Collection;
import java.util.ArrayList;
import javax.persistence.CascadeType;

@Entity
public class Employee implements Serializable {

    @Id
    private String userId;
    private String userPassword;
    private String name;
    private Integer contactOffice;
    private Integer contactMobile;
    private String emailAddress;
    private String department;
    private String accountStatus;
    @Temporal(value = TemporalType.DATE)
    private Date passwordExpiry;
    @Temporal(value = TemporalType.DATE)
    private Date dob;
    private Integer invalidCounter;
    private String designation;
    private Collection<AccessRole> accessRoles = new ArrayList<AccessRole>();

    public Employee() {
    }

    public Employee(String userId, String userPassword, String name, Integer contactOffice, Integer contactMobile, String emailAddress, String department, String accountStatus, Date passwordExpiry, Integer invalidCounter, String designation, Date dob) {
        this.userId = userId;
        this.userPassword = userPassword;
        this.name = name;
        this.contactOffice = contactOffice;
        this.contactMobile = contactMobile;
        this.emailAddress = emailAddress;
        this.department = department;
        this.accountStatus = accountStatus;
        this.passwordExpiry = passwordExpiry;
        this.invalidCounter = invalidCounter;
        this.designation = designation;
        this.dob = dob;
    }

    /**
     * @return the userId
     */
    public String getUserId() {
        return userId;
    }

    /**
     * @param userId the userId to set
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }

    /**
     * @return the userPassword
     */
    public String getUserPassword() {
        return userPassword;
    }

    /**
     * @param userPassword the userPassword to set
     */
    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the contactOffice
     */
    public Integer getContactOffice() {
        return contactOffice;
    }

    /**
     * @param contactOffice the contactOffice to set
     */
    public void setContactOffice(Integer contactOffice) {
        this.contactOffice = contactOffice;
    }

    /**
     * @return the contactMobile
     */
    public Integer getContactMobile() {
        return contactMobile;
    }

    /**
     * @param contactMobile the contactMobile to set
     */
    public void setContactMobile(Integer contactMobile) {
        this.contactMobile = contactMobile;
    }

    /**
     * @return the emailAddress
     */
    public String getEmailAddress() {
        return emailAddress;
    }

    /**
     * @param emailAddress the emailAddress to set
     */
    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

    /**
     * @return the department
     */
    public String getDepartment() {
        return department;
    }

    /**
     * @param department the department to set
     */
    public void setDepartment(String department) {
        this.department = department;
    }

    /**
     * @return the accountStatus
     */
    public String getAccountStatus() {
        return accountStatus;
    }

    /**
     * @param accountStatus the accountStatus to set
     */
    public void setAccountStatus(String accountStatus) {
        this.accountStatus = accountStatus;
    }

    /**
     * @return the passwordExpiry
     */
    public Date getPasswordExpiry() {
        return passwordExpiry;
    }

    /**
     * @param passwordExpiry the passwordExpiry to set
     */
    public void setPasswordExpiry(Date passwordExpiry) {
        this.passwordExpiry = passwordExpiry;
    }

    /**
     * @return the accessRoles
     */
    @ManyToMany(cascade = {CascadeType.PERSIST})
    public Collection<AccessRole> getAccessRoles() {
        return accessRoles;
    }

    /**
     * @param accessRoles the accessRoles to set
     */
    public void setAccessRoles(Collection<AccessRole> accessRoles) {
        this.accessRoles = accessRoles;
    }

    /**
     * @return the invalidCounter
     */
    public Integer getInvalidCounter() {
        return invalidCounter;
    }

    /**
     * @param invalidCounter the invalidCounter to set
     */
    public void setInvalidCounter(Integer invalidCounter) {
        this.invalidCounter = invalidCounter;
    }

    /**
     * @return the designation
     */
    public String getDesignation() {
        return designation;
    }

    /**
     * @param designation the designation to set
     */
    public void setDesignation(String designation) {
        this.designation = designation;
    }

    /**
     * @return the dob
     */
    public Date getDob() {
        return dob;
    }

    /**
     * @param dob the dob to set
     */
    public void setDob(Date dob) {
        this.dob = dob;
    }
}
